package com.controller;

import com.entity.Stores;
import com.service.IStoresService;
import com.until.Result;
import com.vo.Page;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("stores")
public class StoresController extends BaseController{
    @Resource
    private IStoresService storesService;

    @PostMapping("listAll")
    public Result listAll(@RequestBody Page<Stores> page){
        return success(storesService.listAll(page));
    }

    @GetMapping("listAll2")
    public Result listAll2(){
        return success(storesService.getStoresNameAll());
    }

    @GetMapping("queryById")
    public Result queryByEmpId(Integer storesId){
        return success(storesService.queryById(storesId));
    }
    @PostMapping("insert")
    public Result insert(@RequestBody Stores stores){
        return success(storesService.insert(stores));
    }
    @PostMapping("update")
    public Result update(@RequestBody Stores stores){
        return success(storesService.update(stores));
    }
    @DeleteMapping("delete")
    public Result delete(Integer storesId){
        return success(storesService.delete(storesId));
    }
    @PostMapping("storesCloseQueryByParam")
    public Result storesCloseQueryByParam() {
        return success(storesService.storesCloseQueryByParam());
    }
    @RequestMapping(value = "storesStatusUpdate", method = RequestMethod.POST)
    public Result shopStatusUpdate(@RequestBody Stores stores) {
        return success(storesService.storesStatusUpdate(stores));
    }
    @RequestMapping(value = "ShopCloseUpdate", method = RequestMethod.POST)
    public Result storesCloseUpdate(@RequestBody Stores stores) {
        return success(storesService.storesCloseUpdate(stores));
    }
    @GetMapping("getStoresNameAll")
    public Result getStoresNameAll(){
        return success(storesService.getStoresNameAll());
    }
}

